import request from '@/utils/request'
import type { DepartMemberDto, SaleDto } from './types'
import type { PageDto, PageReqDto, PagesDto } from '../types'
import type { StaffInWorkStatusCnEnum } from '@/const/enum'

/**
 * 获取销售人员列表
 *
 * @param params 查询参数
 * @returns 返回销售列表的Promise对象
 */
export function getSaleList(params: {
    auditStatus: number
    limit?: number
    salesName?: string
    deptId?: number
} = { auditStatus: 1 }): Promise<SaleDto[]> {
    return request.get('/crm-prod/crm/sales/querySales', {
        params
    })
}

/**
 * 移除部门或组员
 * @param params 
 * @returns 
 */
export function removeStaff(data: {
    userId: number
}): Promise<void> {
    return request.post('/crm-prod/crm/sales/remove-crm-user', data)
}


/**
 * 获取离职人员列表
 * @param params 
 * @returns 
 */
export function getDepartMemberList(params: PageReqDto & {
    auditStatus: StaffInWorkStatusCnEnum
    startTime?: string
    endTime?: string
}): Promise<PageDto<DepartMemberDto>> {
    return request.get('/crm-prod/crm/sales/dms-list', {
        params
    })
}
